/*
 * Copyright 2008 Zoundry LLC, Inc.  All Rights Reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package org.zoundry.gaedt.services.applications;

import java.util.HashSet;
import java.util.Set;

import org.eclipse.core.resources.IFile;

/**
 * Some util methods for dealing with applications.
 */
public class ZGaeApplicationUtil
{
    private static Set<String> sValidApplicationFileNames = new HashSet<String>();
    private static Set<String> sValidAppYamlFileNames = new HashSet<String>();
    static
    {
        sValidApplicationFileNames.add("app.yaml");
        sValidApplicationFileNames.add("app.yml");
        sValidApplicationFileNames.add("gae.yaml");
        sValidApplicationFileNames.add("gae.yml");

        sValidAppYamlFileNames.add("app.yaml");
        sValidAppYamlFileNames.add("app.yml");
    }

    /**
     * Returns true if the given {@link IFile} is an application resource.  In other
     * words, if it is an app.yaml, gae.yaml file.
     * 
     * @param aFile
     */
    public static boolean isApplicationResource(IFile aFile)
    {
        return sValidApplicationFileNames.contains(aFile.getName());
    }
    
    /**
     * Returns true if the given {@link IFile} is an app.yaml file.
     * 
     * @param aFile
     */
    public static boolean isAppYamlResource(IFile aFile)
    {
        return sValidAppYamlFileNames.contains(aFile.getName());
    }
}
